<template>
	<view>
		<navBar title="计划详情" @goBack="uni.navigateBack()"></navBar>
		
		<view class="plan-details">
			<view class="label-content">
				<view class="title">项目名称</view>
				<view class="value-content">{{ formInfo.pmName }}</view>
			</view>
			<view class="label-content">
				<view class="title">区间/站点</view>
				<view class="value-content no-overflow">{{ formInfo.planConstructionSiteSectionList && formInfo.planConstructionSiteSectionList.length && formInfo.planConstructionSiteSectionList.map(item => item.lineSiteSectionName).join("、") }}</view>
			</view>
			<view class="label-content">
				<view class="title">监控室值班人</view>
				<view class="value-content">{{ formInfo.watchmanUserName }}</view>
			</view>
			<view class="label-content">
				<view class="title">现场带班负责人</view>
				<view class="value-content no-overflow">
					{{formInfo.personnelCallList.filter(it => it.relationType === 'xcdb').map(k => k.personName).join("、") }}
				</view>
			</view>
			<view class="label-content">
				<view class="title">劳务人员</view>
				<view class="value-content">{{ formInfo.labour || '' }}人</view>
			</view>
			<view class="label-content">
				<view class="title">特殊工种作业人员</view>
				<view class="value-content no-overflow">
					{{getPreName(formInfo.personnelCallList.filter(it => it.relationType === 'tsgz').map(item => item.personName).join("、")) || '无'}}
				</view>
			</view>
			<view class="label-content">
				<view class="title">施工开始时间</view>
				<view class="value-content">{{getDate2(formInfo.constructionStartTime)}}</view>
			</view>
			<view class="label-content">
				<view class="title">施工结束时间</view>
				<view class="value-content">{{getDate2(formInfo.constructionEndTime)}}</view>
			</view>
			<view class="label-content">
				<view class="title">提交时间</view>
				<view class="value-content">{{getDate2(formInfo.recordCreateDate)}}</view>
			</view>
			<view class="label-content">
				<view class="title">提交人</view>
				<view class="value-content">{{formInfo.creatorUserName || ''}}</view>
			</view>
		</view>
	</view>
</template>

<script>
	import { constructionPlan_get } from '@/api/comprehensive/comprehensive.js'
	import mixins from "@/utils/mixins.js"
	export default {
		mixins: [mixins],
		data() {
			return {
				formInfo:{
					personnelCallList:[]
				}
			}
		},
		methods: {
			getDetailInfo(id) {
				constructionPlan_get({id}).then(res => {
					if(!res.success) return
					this.formInfo = res.result
				})
			},
			//匹配括号前的人名
			getPreName(str) {
				if(!str) return ''
				return str.replace(/\([^)]*\)/g, '');
			}
		},
		onLoad(op) {
			if(op && op.id) {
				this.getDetailInfo(op.id)
			}
		},
	}
</script>

<style scoped lang="scss">
	.plan-details {
		border-top: 20px solid #f5f7fa;
		background: #fff;
		/* #ifdef MP-WEIXIN */
		padding-top: 180rpx;
		/* #endif */
		.no-overflow {
			text-overflow: initial !important;
			white-space: initial !important;
			overflow: initial !important;
			line-height: initial !important;
		}
		.label-content {
			padding: 0 16px;
			line-height: 50px;
			font-size: 16px;
			border-top: 1px solid #f4f5f8;
			display: flex;
			align-items: center;
			justify-content: space-between;
			&:nth-child(1) {
				border-top: none;
			}
			.title {
				color: #445469;
				flex-shrink: 0;
				margin-right: 10px;
				max-width: 456upx;
				white-space: nowrap;
				overflow: hidden;
				text-overflow: ellipsis;
			}
			.value-content {
				max-width: 350upx;
				color: #22204e;
				text-align: right;
				text-overflow: ellipsis;
				white-space: nowrap;
				overflow: hidden;
			}
		}
	}
</style>
